<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$Think.config.sitename}</title>
<link href="__PUBLIC__/dwz/themes/css/login.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/dwz/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/dwz/js/md5.js" type="text/javascript"></script>
</head>
<body>
<div id="login">
	<div id="login_header">
		<h1 class="login_logo">
			<a href="__APP__"><img src="__PUBLIC__/dwz/themes/default/images/login_logo.gif" /></a>
		</h1>
		<div class="login_headerContent">
			<div class="navList">
				<ul>
					<li><a href="#">设为首页</a></li>
					<li><a href="#">升级说明</a></li>
					<li><a href="#">反馈</a></li>
					<li><a href="#">帮助</a></li>
				</ul>
			</div>
			<h2 class="login_title"><img src="__PUBLIC__/dwz/themes/default/images/login_title.png" /></h2>
		</div>
	</div>
	<div id="login_content">
		<div class="loginForm">
			<form method="post" action="__URL__/checkLogin/" name="login" id="loginform">
				<p>
					<label align="right">帐号：</label>
                    <input type="text" name="account" id="account" size="20" class="login_input" />
				</p>
				<p>
					<label align="right">密码：</label>
                    <input type="password" class="login_input" name="input_pwd" id="input_pwd" size="20" />
					<input type="hidden" name="password" id="password" />
				</p>
				<p>
					<label align="right">验证码：</label>
                    <input class="code" name="verify" id="verify" type="text" size="8" onkeydown="keydown(event)" maxlength="4" />
                    <img id="verifyImg" src="__URL__/verify/" onclick="fleshVerify();" border="0" alt="点击刷新验证码" style="cursor: pointer" align="absmiddle" />
				</p>
				<div class="login_bar">
					<input class="sub" type="button" value=" " onClick="checkInput();" />
				</div>
				<p>
					<span id="logmsg" style="color: red;"></span>
				</p>
			</form>
		</div>
		<div class="login_banner"><img src="__PUBLIC__/dwz/themes/default/images/login_banner.jpg" /></div>
		<div class="login_main"></div>
	</div>
	<div id="login_footer">Copyright &copy; 2009 {$Think.config.COMPANY} Inc. All Rights Reserved.</div>
</div>
<script language="JavaScript">
<?php
$msg = '';
if(isset($_GET['loginerr'])){
	if($_GET['loginerr'] == 'loginid'){
		$msg = '用户名输入错误！';
	}
	elseif($_GET['loginerr'] == 'password'){
		$msg = '密码输入错误！';
	}
	elseif($_GET['loginerr'] == 'verify'){
		$msg = '验证码输入错误！';
	}
	elseif($_GET['loginerr'] == 'auth'){
		$msg = '权限受限！';
	}
	elseif($_GET['loginerr'] == 'timeout'){
		$msg = '登录超时！';
	}
?>
logmsg.innerHTML = "<?php echo $msg;?>";
<?php }?>

$("#account").focus();

function keydown(e){
	var e = e || event;
	if (e.keyCode==13){
	    if($("#account").val()==''){
	        $("#logmsg").html('用户名不能为空！');
	        $("#account").focus();
	        return false;
	    }else if($("#input_pwd").val()==''){
	        $("#logmsg").html('密码不能为空！');
	        $("#input_pwd").focus();
	        return false;
	    }else if($("#verify").val()==''){
	        $("#logmsg").html('验证不能为空！');
	        $("#verify").focus();
	        return false;
	    }else if($("#verify").val().length != 4){
	        $("#logmsg").html('验证输入有误！');
	        $("#verify").focus();
	        return false;
	    }
	    $("#password").val(hex_md5($("#input_pwd").val()));
	    $("#input_pwd").val('');
	    $("#loginform").submit();
	}
}

function checkInput(){
	if($("#account").val()==''){
		$("#logmsg").html('用户名不能为空！');
		$("#account").focus();
		return false;
	}else if($("#input_pwd").val()==''){
		$("#logmsg").html('密码不能为空！');
		$("#input_pwd").focus();
		return false;
	}else if($("#verify").val()==''){
		$("#logmsg").html('验证不能为空！');
		$("#verify").focus();
		return false;
	}else if($("#verify").val().length != 4){
		$("#logmsg").html('验证输入有误！');
		$("#verify").focus();
		return false;
	}
	$("#password").val(hex_md5($("#input_pwd").val()));
	$("#input_pwd").val('');
	$("#loginform").submit();
}

function fleshVerify(){
	//重载验证码
	$("#verifyImg").attr('src','__URL__/verify/'+new Date().getTime());
}
</script>
</body>
</html>